package com.winter.main.utils;

import com.winter.main.constant.SystemConstant;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;

import java.util.ResourceBundle;

/**
 * Desc: 加载静态资源
 * Author: dushuang
 * Date: Create in 2018/4/27
 */
@Component
public class ParamInitComponent {

    private static Logger logger = LogManager.getLogger(ParamInitComponent.class);

    static {
        // 极验
        ResourceBundle geetest_bundle = ResourceBundle.getBundle("geetest");
        if (geetest_bundle == null) {
            throw new IllegalArgumentException("[geetest.properties] is not found!");
        }
        SystemConstant.GEETEST_ID = geetest_bundle.getString("geetest.geetestId");
        SystemConstant.GEETEST_KEY = geetest_bundle.getString("geetest.geetestkey");
        try {
            SystemConstant.GEETEST_NEWFAILBACK = Boolean.parseBoolean(geetest_bundle.getString("geetest.geetestNewFailback"));
        } catch (Exception e) {
            logger.error("获取GEETEST_NEWFAILBACK异常:"+e.getMessage());
        }


    }


}
